home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWFiles / Include / SLFileSp.idl < prev    next >
Encoding:
Text File  |  1996-04-25  |  5.7 KB  |  212 lines  |  [TEXT/MPS ]

  1. //
  2. //    File:                SLFilesp.idl
  3. //
  4. //    Contains:            Interfaces for FW_OFileSpecification and FW_ODirectorySpecification classes
  5. //    Release Version:    $ ODF 1 $
  6. //
  7. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  8. //
  9.  
  10. #ifndef SLFILESP_IDL
  11. #define SLFILESP_IDL
  12.  
  13. #ifndef SLSTDDEF_IDL
  14. #include "SLStdDef.idl"
  15. #endif
  16.  
  17. #ifndef SLTXTTYP_IDL
  18. #include "SLTxtTyp.idl"
  19. #endif
  20.  
  21. #include <somobj.idl>
  22. #include <somcls.idl>
  23.  
  24.  
  25. //==============================================================================
  26. // Classes defined in this interface
  27. //==============================================================================
  28.  
  29. interface FW_OFileSpecification;
  30. interface FW_ODirectorySpecification;
  31.  
  32.  
  33. //==============================================================================
  34. // Types used by this interface
  35. //==============================================================================
  36.  
  37. typedef somToken FW_CPrivFileSpecification;
  38. // typedef somToken FW_CString;
  39. typedef somToken FSSpec;
  40.  
  41.  
  42. //========================================================================================
  43. //    FW_OFileSpecification
  44. //
  45. //    This class is used to identify a disk-based file.  
  46. //========================================================================================
  47.  
  48. interface FW_OFileSpecification : SOMObject
  49. {
  50.     void InitFromFileName(in FW_HString fileName);
  51.         // Create a file specification from a full or partial pathname.  In the case of
  52.         //   a partial pathname, the specification will use the current default
  53.         //   directory to build a full pathname.
  54.  
  55.     void InitFromDirectoryAndName(in FW_ODirectorySpecification directory,
  56.                                   in FW_HString fileName);
  57.         // Create a file specification from a directory and a file name.  The file name
  58.         //   should include any extensions that might be necessary.
  59.             
  60.  
  61.     void GetName(out FW_HString fileName);
  62.         // Get the name of the file.
  63.  
  64.     FW_ODirectorySpecification GetParentDirectory();
  65.         // Returns the path information for this file.
  66.  
  67.     void GetFullPath(out FW_HString fullPathName);
  68.         // Returns the fully qualified path and file name for this file.  The user should
  69.         //   pass in a dynamic string so as to guarantee that the path will fit inside
  70.         //   it.
  71.         
  72.  
  73.     //===========================================================
  74.     // Operators
  75.     //===========================================================
  76.  
  77.     FW_Boolean IsSameAs(in FW_OFileSpecification theOtherFile);
  78.         // Does this file represent the same file as theOtherFile.
  79.  
  80.     void AssignOFileSpecification(in FW_OFileSpecification theOtherFile);
  81.         // Copy all of the file information from theOtherFile so that this file spec
  82.         //   represents the same file.  (Use this for the copy constructor).
  83.  
  84.     void AssignFileName(in FW_HString fileName);
  85.         // Change the name of this file to fileName.  fileName may be a partial pathName.
  86.         // This does not change any of the existing path information.
  87.  
  88.  
  89. #ifdef FW_BUILD_WIN
  90.     char WinGetDrive();
  91.         // Get the letter of the drive this file is on and return it as a lower-case
  92.         //   character.  
  93.         
  94.     void WinGetExtension(out FW_HString extension);
  95.         // Get the file name extension for the Windows file.
  96.         
  97.     void WinSetExtension(in FW_HString extension);
  98.         // Set the file name extension for the Windows file.
  99. #endif
  100.  
  101. #ifdef FW_BUILD_MAC
  102.     void AssignFileSpec(in FSSpec* macSpec);
  103.         // This specifier will now represent the file described by macSpec.
  104.     
  105.     void MacGetFSSpec(out FSSpec macSpec);
  106.         // Return a Macintosh FSSpec that points to this file.
  107.  
  108.     void MacSetTypeAndCreator(in FW_ResourceType aFileType, in FW_ResourceType aCreatorType);
  109.     void MacGetTypeAndCreator(out FW_ResourceType aFileType, out FW_ResourceType aCreatorType);
  110.         // Accessors to the type and creator of the file specification.
  111. #endif
  112.  
  113. #ifdef __SOMIDL__
  114. implementation
  115.     {
  116.         functionprefix = FW_OFileSpecification__;
  117.     
  118.         override:
  119.             somInit,
  120.             somUninit;
  121.             
  122.         releaseorder:
  123.             somInit,
  124.             somUninit,
  125.  
  126.             InitFromFileName,
  127.             InitFromDirectoryAndName,
  128.             GetName,
  129.             GetParentDirectory,
  130.             GetFullPath,
  131.             IsSameAs,
  132.             AssignOFileSpecification,
  133.             AssignFileName,
  134.             
  135. #ifdef FW_BUILD_WIN
  136.             WinGetDrive,
  137.             WinGetExtension,
  138.             WinSetExtension;
  139. #endif
  140.  
  141. #ifdef FW_BUILD_MAC
  142.             AssignFileSpec,
  143.             MacGetFSSpec,
  144.             MacSetTypeAndCreator,
  145.             MacGetTypeAndCreator;
  146. #endif
  147.                 
  148.         majorversion = 1;
  149.         minorversion = 0;
  150.  
  151.         passthru C_xh =
  152.             "";
  153.  
  154.         passthru C_xih =
  155.             "";
  156.  
  157. #ifdef __PRIVATE__
  158.         FW_CPrivFileSpecification *fRep;
  159. #endif
  160.   };
  161. #endif //# __SOMIDL__
  162. };
  163.  
  164.  
  165. //========================================================================================
  166. //    FW_ODirectorySpecification
  167. //
  168. //    This class is used to indentify a disk-based directory. A directory uses most of the
  169. //      same information as a file specification, but is not a file.  However, we inherit 
  170. //      from FW_OFileSpecification for reuse.  (SOM doesn't have private inheritance).
  171. //========================================================================================
  172. interface FW_ODirectorySpecification : FW_OFileSpecification
  173. {
  174.     //===========================================================
  175.     // Operators
  176.     //===========================================================
  177.  
  178.     void AppendDirectoryName(in FW_HString directoryName);
  179.         // Add directoryName to the end of this path.  This routine will add a path
  180.         //   separator so that the user does not need to.  The remaining path information
  181.         //   may specify a subdirectory or parent directory, but must start from this
  182.         //   directory.
  183.         
  184. #ifdef __SOMIDL__
  185. implementation
  186.     {
  187.         functionprefix = FW_ODirectorySpecification__;
  188.     
  189.         override:
  190.             somInit,
  191.             GetFullPath;
  192.  
  193.         releaseorder:
  194.             AppendDirectoryName;
  195.  
  196.         majorversion = 1;
  197.         minorversion = 0;
  198.  
  199.         passthru C_xh =
  200.             "";
  201.  
  202.         passthru C_xih =
  203.             "";
  204.  
  205. #ifdef __PRIVATE__
  206. #endif
  207.   };
  208. #endif //# __SOMIDL__
  209. };
  210.  
  211. #endif
  212.